package com.finance.report.service;

import com.finance.base.enums.CalculateTypeEnum;
import com.finance.base.enums.MajorTypeEnum;
import com.finance.report.bean.pojo.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

/**
 * Created by CBWL on 2017/5/10.
 */
@Component
public class SalaryService implements ISalaryService {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private SalaryHelper salaryHelper;

    @Override
    public void commitFee(LogisticsData logisticsData, LogisticsExtend logisticsExtend, BigDecimal fee, CalculateTypeEnum calculateTypeEnum, MajorTypeEnum majorTypeEnum, Long ruleId) {
        try{
            this.logger.info("开始计算快递员配费 运单号：{}",logisticsData.getWaybillNum());
            this.salaryHelper.commitFee(logisticsData, logisticsExtend, fee, calculateTypeEnum, majorTypeEnum, ruleId);
        }catch (Exception e){
            this.logger.error(e.getMessage(),e);
        }
    }
}
